#
# @lc app=leetcode.cn id=1103 lang=python3
#
# [1103] 分糖果 II
#

# @lc code=start
class Solution:
    def distributeCandies(self, candies: int, num_people: int) -> List[int]:
        ans=[]
        sum_cand=0
        index=1
        for i in range(num_people):
            ans.append(0)
        while True:
            for i in range(num_people):
                if sum_cand+index<candies:
                    sum_cand+=index
                    ans[i]+=index
                    index+=1
                else:
                    ans[i]+=candies-sum_cand
                    return ans

# @lc code=end

